#!/bin/bash

echo "🐳 开始构建 TODO List Docker 镜像..."
echo ""

# 停止并删除旧容器
echo "1️⃣ 清理旧容器..."
docker-compose -f docker-compose.full.yml down

# 构建镜像
echo ""
echo "2️⃣ 构建 Docker 镜像..."
docker-compose -f docker-compose.full.yml build --no-cache

# 启动服务
echo ""
echo "3️⃣ 启动所有服务..."
docker-compose -f docker-compose.full.yml up -d

# 等待服务启动
echo ""
echo "⏳ 等待服务启动..."
sleep 10

# 显示状态
echo ""
echo "📊 服务状态："
docker-compose -f docker-compose.full.yml ps

echo ""
echo "✅ 部署完成！"
echo ""
echo "访问地址："
echo "  前端: http://localhost:3000"
echo "  后端: http://localhost:3001"
echo "  MySQL: localhost:6606"
echo ""
echo "查看日志："
echo "  docker-compose -f docker-compose.full.yml logs -f"

